﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using WmsApp.UI;

namespace WmsApp.Window
{
    public partial class FormPayApplyBillItemEditor : DevExpress.XtraEditors.XtraForm
    {
        public static string  ShowForm(string payApplyBillID)
        {
            var form = new FormPayApplyBillItemEditor(payApplyBillID);
            form.ShowDialog();
            if(form.DialogResult == System.Windows.Forms.DialogResult.OK)
            {
                return form.PayApplyBillItemID;
            }
            else
            {
                return null;
            }
        }

        public FormPayApplyBillItemEditor(string payApplyBillID)
        {
            InitializeComponent();
            this.payApplyBillItemCtlMain.BindingPayApplyBillID(payApplyBillID);
            this.payApplyBillItemCtlMain.PayApplyBillItemCtlCmdExcuting += PayApplyBillItemCtlMainPayApplyBillItemCtlCmdExcuting;
        }

        public string PayApplyBillItemID
        {
            get
            {
                return this.payApplyBillItemCtlMain.PayApplyBillItemID;
            }
        }

        private void PayApplyBillItemCtlMainPayApplyBillItemCtlCmdExcuting(PayApplyBillItemCmdExcutingType payApplyBillItemCmdExcutingType, string payApplyBillItemID)
        {
            this.DialogResult =
                payApplyBillItemCmdExcutingType == PayApplyBillItemCmdExcutingType.Closing ?System.Windows.Forms. DialogResult.Cancel : System.Windows.Forms.DialogResult.OK;
        }
    }
}